home *** CD-ROM | disk | FTP | other *** search
/ Enter 2002 August / EnterCD 8_2002.iso / Internet / Adobe GoLive 6.0 / data1.cab / PF_AppDir_Mod_ExtendScripts_WMLExt / inspect.js < prev    next >
Encoding:
JavaScript  |  2002-03-28  |  14.1 KB  |  388 lines

  1. //------------------------------------------------------------------------------
  2. //
  3. // ADOBE SYSTEMS INCORPORATED
  4. // Copyright 2000-2002 Adobe Systems Incorporated 
  5. // All Rights Reserved
  6. //
  7. // NOTICE: Adobe permits you to use, modify, and distribute 
  8. // this file in accordance with the terms of the Adobe license 
  9. // agreement accompanying it. If you have received this file 
  10. // from a source other than Adobe, then your use, modification, 
  11. // or distribution of it requires the prior written permission 
  12. // of Adobe.
  13. //
  14. //------------------------------------------------------------------------------
  15.  
  16.  
  17. //----------------------------------------------------
  18. // inspect functions:
  19. //
  20. // Description:
  21. //   Called by inspectBox() for each custom box.
  22. //   Sets up inspector control values based on 
  23. //   custom box settings.
  24.  
  25. function inspectA(box)
  26. {
  27.     if (!document) {
  28.         // need document for getWMLVersion()
  29.         // an inspector should always have a
  30.         // document anyway.
  31.         return;
  32.     }
  33.     var version = getWMLVersion(document);
  34.     
  35.     if (version == "1.1") {
  36.         box.classid = "idA11";
  37.     }
  38.     else {
  39.         box.classid = "idA";
  40.     }
  41.         
  42.     var insp = box.inspector;            
  43.     insp.ctlAID.value = (box.element["id"]) ? box.element["id"] : "";
  44.     insp.ctlAClass.value = (box.element["class"]) ? box.element["class"] : "";
  45.     insp.ctlATitle.value = (box.element["title"]) ? box.element["title"] : "";        
  46.     insp.ctlAXMLLang.value = (box.element["xml:lang"]) ? box.element["xml:lang"] : "";
  47.     if (version == "1.1") {
  48.         insp.ctlA11href.setLink (box.ctlAhref);
  49.     }
  50.     else {
  51.         insp.ctlAhref.setLink (box.ctlAhref);
  52.     }
  53.     
  54.     if (version != "1.1") {
  55.         // default to 1.3 behavior
  56.         insp.ctlAAccess.value = (box.element["accesskey"]) ? box.element["accesskey"] : "";
  57.     }
  58. }
  59.             
  60. function inspectAnchor(box)
  61. {
  62.     if (!document) {
  63.         // need document for getWMLVersion()
  64.         // an inspector should always have a
  65.         // document anyway.
  66.         return;
  67.     }
  68.     var version = getWMLVersion(document);
  69.     
  70.     if (version == "1.1") {
  71.         box.classid = "idAnchor11";
  72.     }
  73.     else {
  74.         box.classid = "idAnchor";
  75.     }
  76.     
  77.     var insp = box.inspector;
  78.     insp.ctlAnchorID.value = (box.element["id"]) ? box.element["id"] : "";
  79.     insp.ctlAnchorClass.value = (box.element["class"]) ? box.element["class"] : "";
  80.     insp.ctlAnchorTitle.value = (box.element["title"]) ? box.element["title"] : "";
  81.     insp.ctlAnchorXMLLang.value = (box.element["xml:lang"]) ? box.element["xml:lang"] : "";
  82.     
  83.     if (version != "1.1") { 
  84.         // default to 1.3 behavior
  85.         insp.ctlAnchorAccess.value = (box.element["accesskey"]) ? box.element["accesskey"] : "";
  86.     }
  87. }
  88.             
  89. function inspectCard (box) 
  90. {                
  91.     var insp = box.inspector;            
  92.     insp.controls["title"].value = (box.element.title) ? box.element.title : "";
  93.     insp.controls["onenterforward"].setLink (box.onenterforward);
  94.     insp.controls["onenterbackward"].setLink (box.onenterbackward);
  95.     insp.controls["ontimer"].setLink (box.ontimer);    
  96.                     
  97.     // false is the default value
  98.     insp.controls["newcontext"].value = (box.element.newcontext) ? box.element.newcontext : "false";
  99.  
  100.     // true is the default value
  101.     insp.controls["ordered"].value = (box.element.ordered) ? box.element.ordered : "true";        
  102.             
  103.     insp.controls["id"].value = (box.element.id) ? box.element.id : "";
  104.     insp.controls["classCard"].value = (box.element ["class"]) ? box.element["class"] : "";        
  105.     insp.cXMLLang.value = (box.element["xml:lang"]) ? box.element["xml:lang"] : "";             
  106. }
  107.  
  108. function inspectDo (box)
  109. {
  110.     var insp = box.inspector;
  111.     insp.ctlDoID.value = (box.element["id"]) ? box.element["id"] : "";
  112.     insp.ctlDoClass.value = (box.element["class"]) ? box.element["class"] : "";
  113.     insp.ctlDoLabel.value = (box.element["label"]) ? box.element["label"] : "";
  114.     insp.ctlDoName.value = (box.element["name"]) ? box.element["name"] : "";
  115.     // false is the default value
  116.     insp.ctlDoOptional.value = (box.element["optional"]) ? box.element["optional"] : "false";
  117.     insp.ctlDoXMLLang.value = (box.element["xml:lang"]) ? box.element["xml:lang"] : "";
  118.                 
  119.     // set insp.ctlDoType
  120.     if (box.element["type"]) {
  121.         switch (box.element["type"]) {
  122.         case "accept":
  123.         case "prev":
  124.         case "help":
  125.         case "reset":
  126.         case "options":
  127.         case "delete":
  128.             insp.ctlDoType.value = box.element["type"];
  129.             insp.ctlDoTypeEdit.enabled = false;
  130.             insp.ctlDoTypeEdit.posx = 9000;
  131.             break;
  132.         default:
  133.             insp.ctlDoType.value = "unknown";
  134.             insp.ctlDoTypeEdit.enabled = true;
  135.             insp.ctlDoTypeEdit.value = box.element["type"];
  136.             insp.ctlDoTypeEdit.posx = 162;
  137.             break;
  138.         }
  139.     }
  140.     else { // type attr not defined
  141.         insp.ctlDoType.value = "unknown";
  142.         insp.ctlDoTypeEdit.enabled = true;
  143.         insp.ctlDoTypeEdit.value = "";
  144.         insp.ctlDoTypeEdit.posx = 162;
  145.     }
  146. }
  147.  
  148. function inspectFieldset(box)
  149. {
  150.     var insp = box.inspector;
  151.     insp.ctlFieldSetID.value = (box.element["id"]) ? box.element["id"] : "";
  152.     insp.ctlFieldSetClass.value = (box.element["class"]) ? box.element["class"] : "";
  153.     insp.ctlFieldSetTitle.value = (box.element["title"]) ? box.element["title"] : "";
  154.     insp.ctlFieldSetXMLLang.value = (box.element["xml:lang"]) ? box.element["xml:lang"] : "";
  155. }
  156.  
  157. function inspectGo(box)
  158. {
  159.     if (!document) {
  160.         // need document for getWMLVersion()
  161.         // an inspector should always have a
  162.         // document anyway.
  163.         return;
  164.     }
  165.     var version = getWMLVersion(document);
  166.     
  167.     if (version == "1.1") {
  168.         box.classid = "idGo11";
  169.     }
  170.     else {
  171.         box.classid = "idGo";
  172.     }
  173.     
  174.     var insp = box.inspector;
  175.     if (version == "1.1") {
  176.         insp.ctlGo11Href.enabled = true;
  177.         insp.ctlGo11Href.setLink (box.ctlGoHref);
  178.     }
  179.     else {
  180.         insp.ctlGoHref.enabled = true;
  181.         insp.ctlGoHref.setLink (box.ctlGoHref);
  182.     }
  183.     insp.ctlGoID.value = (box.element["id"]) ? box.element["id"] : "";
  184.     insp.ctlGoClass.value = (box.element["class"]) ? box.element["class"] : "";
  185.     insp.ctlGoMethod.value = (box.element["method"]) ? box.element["method"] : "get";
  186.     insp.ctlGoAccChar.value = (box.element["accept-charset"]) ? box.element["accept-charset"] : "";
  187.     insp.ctlGoSendref.value = (box.element["sendreferer"]) ? box.element["sendreferer"] : "false";
  188.     
  189.     if (version != "1.1") {
  190.         // default to 1.3 attributes
  191.         insp.ctlGoEnctype.value = (box.element["enctype"]) ? box.element["enctype"] : "";
  192.         insp.ctlGoCache.value = (box.element["cache-control"]) ? box.element["cache-control"] : " ";
  193.     }
  194. }
  195.  
  196.  
  197. function inspectImg(box)
  198. {
  199.     var insp = box.inspector;                
  200.     insp.ctlImgid.value = (box.element["id"]) ? box.element["id"] : "";
  201.     insp.ctlImgclass.value = (box.element["class"]) ? box.element["class"] : "";
  202.     insp.ctlImgalt.value = (box.element["alt"]) ? box.element["alt"] : "";
  203.     insp.ctlImglocalsrc.value = (box.element["localsrc"]) ? box.element["localsrc"] : "";
  204.     insp.ctlImgvspace.value = (box.element["vspace"]) ? box.element["vspace"] : "0";
  205.     insp.ctlImghspace.value = (box.element["hspace"]) ? box.element["hspace"] : "0";
  206.     insp.ctlImgalign.value = (box.element["align"]) ? box.element["align"] : "bottom";
  207.     insp.ctlImgheight.value = (box.element["height"]) ? box.element["height"] : "";
  208.     insp.ctlImgwidth.value = (box.element["width"]) ? box.element["width"] : "";
  209.     insp.ctlImgXMLLang.value = (box.element["xml:lang"]) ? box.element["xml:lang"] : "";
  210.     insp.ctlImgsrc.setLink (box.ctlImgsrc);
  211. }
  212.             
  213. function inspectInput(box)
  214. {
  215.     if (!document) {
  216.         // need document for getWMLVersion()
  217.         // an inspector should always have a
  218.         // document anyway.
  219.         return;
  220.     }
  221.     var version = getWMLVersion(document);
  222.  
  223.     if (version == "1.1") {
  224.         box.classid = "idInput11";
  225.     }
  226.     else {
  227.         box.classid = "idInput";
  228.     }
  229.     
  230.     var insp = box.inspector;
  231.     insp.ctlInputID.value = (box.element["id"]) ? box.element["id"] : "";
  232.     insp.ctlInputClass.value = (box.element["class"]) ? box.element["class"] : "";
  233.     insp.ctlInputName.value = (box.element["name"]) ? box.element["name"] : "";
  234.     insp.ctlInputType.value = (box.element["type"]) ? box.element["type"] : "text";
  235.     insp.ctlInputSize.value = (box.element["size"]) ? box.element["size"] : "";
  236.     insp.ctlInputMaxLength.value = (box.element["maxlength"]) ? box.element["maxlength"] : "";
  237.     insp.ctlInputTabIndex.value = (box.element["tabindex"]) ? box.element["tabindex"] : "";
  238.     insp.ctlInputXMLLang.value = (box.element["xml:lang"]) ? box.element["xml:lang"] : "";
  239.     insp.ctlInputValue.value = (box.element["value"]) ? box.element["value"] : "";
  240.     insp.ctlInputFormat.value = (box.element["format"]) ? box.element["format"] : "";
  241.     insp.ctlInputTitle.value = (box.element["title"]) ? box.element["title"] : "";
  242.     
  243.     if (version == "1.1")
  244.         insp.ctlInputEmptyOK.value = (box.element["emptyok"]) ? box.element["emptyok"] : "false";
  245.     else {
  246.         // default to 1.3
  247.         insp.ctlInputEmptyOK.value = (box.element["emptyok"]) ? box.element["emptyok"] : " ";
  248.         insp.ctlInputAccess.value = (box.element["accesskey"]) ? box.element["accesskey"] : "";
  249.     }
  250. }
  251.  
  252. function inspectNoop(box)
  253. {
  254.     var insp = box.inspector;
  255.     insp.ctlNoopID.value = (box.element["id"]) ? box.element["id"] : "";
  256.     insp.ctlNoopClass.value = (box.element["class"]) ? box.element["class"] : "";
  257. }
  258.             
  259. function inspectOnevent(box)
  260. {
  261.     var insp = box.inspector;
  262.     insp.ctlOnEventID.value = (box.element["id"]) ? box.element["id"] : "";
  263.     insp.ctlOnEventClass.value = (box.element["class"]) ? box.element["class"] : "";
  264.             
  265.     // set insp.ctlOnEventType
  266.     if (box.element["type"]) {
  267.         switch (box.element["type"]) {
  268.         case "ontimer":
  269.         case "onenterforward":
  270.         case "onenterbackward":
  271.         case "onpick":
  272.             insp.ctlOnEventType.value = box.element["type"];
  273.             insp.ctlOnEventTypeEdit.enabled = false;
  274.             insp.ctlOnEventTypeEdit.posx = 9000;
  275.             break;
  276.         default:
  277.             insp.ctlOnEventType.value = "unknown";
  278.             insp.ctlOnEventTypeEdit.enabled = true;
  279.             insp.ctlOnEventTypeEdit.value = box.element["type"];
  280.             insp.ctlOnEventTypeEdit.posx = 170;
  281.             break;
  282.         }
  283.     }
  284.     else { // type attr not defined
  285.         insp.ctlOnEventType.value = "unknown";
  286.         insp.ctlOnEventTypeEdit.enabled = true;
  287.         insp.ctlOnEventTypeEdit.value = "";
  288.         insp.ctlOnEventTypeEdit.posx = 170;
  289.     }
  290. }            
  291.  
  292. function inspectOption(box)
  293. {
  294.     var insp = box.inspector;
  295.     insp.ctlOptionID.value = (box.element["id"]) ? box.element["id"] : "";
  296.     insp.ctlOptionClass.value = (box.element["class"]) ? box.element["class"] : "";
  297.     insp.ctlOptionTitle.value = (box.element["title"]) ? box.element["title"] : "";
  298.     insp.ctlOptionValue.value = (box.element["value"]) ? box.element["value"] : "";
  299.     insp.ctlOptionOnPick.value = (box.element["onpick"]) ? box.element["onpick"] : "";
  300.     insp.ctlOptionXMLLang.value = (box.element["xml:lang"]) ? box.element["xml:lang"] : "";
  301. }
  302.  
  303. function inspectOptiongroup(box)
  304. {
  305.     var insp = box.inspector;
  306.     insp.ctlOptGroupID.value = (box.element["id"]) ? box.element["id"] : "";
  307.     insp.ctlOptGroupClass.value = (box.element["class"]) ? box.element["class"] : "";
  308.     insp.ctlOptGroupTitle.value = (box.element["title"]) ? box.element["title"] : "";
  309.     insp.ctlOptGroupXMLLang.value = (box.element["xml:lang"]) ? box.element["xml:lang"] : "";
  310. }
  311.  
  312. function inspectPostfield(box)
  313. {                
  314.     var insp = box.inspector;
  315.     insp.ctlPostFieldID.value = (box.element["id"]) ? box.element["id"] : "";
  316.     insp.ctlPostFieldClass.value = (box.element["class"]) ? box.element["class"] : "";
  317.     insp.ctlPostFieldName.value = (box.element["name"]) ? box.element["name"] : "";
  318.     insp.ctlPostFieldValue.value = (box.element["value"]) ? box.element["value"] : "";
  319. }
  320.  
  321. function inspectPre(box)
  322. {
  323.     var insp = box.inspector;
  324.     insp.ctlPreID.value = (box.element["id"]) ? box.element["id"] : "";
  325.     insp.ctlPreClass.value = (box.element["class"]) ? box.element["class"] : "";
  326.     insp.ctlPreXmlSpace.value = (box.element["xml:space"]) ? box.element["xml:space"] : "";
  327.  
  328. }
  329.  
  330. function inspectPrev(box)
  331. {
  332.     var insp = box.inspector;
  333.     insp.ctlPrevID.value = (box.element["id"]) ? box.element["id"] : "";
  334.     insp.ctlPrevclass.value = (box.element["class"]) ? box.element["class"] : "";
  335. }
  336.  
  337. function inspectRefresh(box)
  338. {
  339.     var insp = box.inspector;
  340.     insp.ctlRefreshID.value = (box.element["id"]) ? box.element["id"] : "";
  341.     insp.ctlRefreshclass.value = (box.element["class"]) ? box.element["class"] : "";
  342. }
  343.  
  344. function inspectSelect(box)
  345. {
  346.     var insp = box.inspector;
  347.     insp.ctlSelectID.value = (box.element["id"]) ? box.element["id"] : "";
  348.     insp.ctlSelectClass.value = (box.element["class"]) ? box.element["class"] : "";
  349.     insp.ctlSelectName.value = (box.element["name"]) ? box.element["name"] : "";
  350.     insp.ctlSelectMultiple.value = (box.element["multiple"]) ? box.element["multiple"] : "false";
  351.     insp.ctlSelectTabIndex.value = (box.element["tabindex"]) ? box.element["tabindex"] : "";
  352.     insp.ctlSelectTitle.value = (box.element["title"]) ? box.element["title"] : "";
  353.     insp.ctlSelectValue.value = (box.element["value"]) ? box.element["value"] : "";
  354.     insp.ctlSelectiname.value = (box.element["iname"]) ? box.element["iname"] : "";
  355.     insp.ctlSelectXMLLang.value = (box.element["xml:lang"]) ? box.element["xml:lang"] : "";
  356.     insp.ctlSelectivalue.value = (box.element["ivalue"]) ? box.element["ivalue"] : "";
  357. }
  358.             
  359. function inspectSetvar(box)
  360. {
  361.     var insp = box.inspector;
  362.     insp.ctlSetvarID.value = (box.element["id"]) ? box.element["id"] : "";
  363.     insp.ctlSetvarClass.value = (box.element["class"]) ? box.element["class"] : "";
  364.     insp.ctlSetvarName.value = (box.element["name"]) ? box.element["name"] : "";
  365.     insp.ctlSetvarValue.value = (box.element["value"]) ? box.element["value"] : "";
  366. }
  367.  
  368. function inspectTemplate(box) 
  369. {
  370.     var insp = box.inspector;                                            
  371.     insp.ctlTemplateOnEnterForward.enabled = true;
  372.     insp.ctlTemplateOnEnterBackward.enabled = true;
  373.     insp.ctlTemplateOnTimer.enabled = true;    
  374.     insp.ctlTemplateID.value = (box.element.id) ? box.element.id : "";
  375.     insp.ctlTemplateClass.value = (box.element["class"]) ? box.element["class"] : "";
  376.     insp.ctlTemplateOnEnterForward.setLink (box.ctlTemplateOnEnterForward);    
  377.     insp.ctlTemplateOnEnterBackward.setLink (box.ctlTemplateOnEnterBackward);
  378.     insp.ctlTemplateOnTimer.setLink (box.ctlTemplateOnTimer);
  379. }
  380.  
  381. function inspectTimer(box)
  382. {
  383.     var insp = box.inspector;                
  384.     insp.ctlTimerID.value = (box.element["id"]) ? box.element["id"] : "";
  385.     insp.ctlTimerClass.value = (box.element["class"]) ? box.element["class"] : "";
  386.     insp.ctlTimerName.value = (box.element["name"]) ? box.element["name"] : "";
  387.     insp.ctlTimerValue.value = (box.element["value"]) ? box.element["value"] : "";
  388. }